<template>
  <div id="app">
    <router-view></router-view>
    <div id="aplayer"></div>
    <div
      class="loading"
      v-if="isLoading"
    >
      <img
        src="https://o6wndwjxn.qnssl.com/fang.gif"
        style="width:70px;margin-bottom:60px"
      >
    </div>
  </div>
</template>
<script>
import { zhuan } from '@/store/aduio'
import { mapState } from 'vuex'
// import 'APlayer/dist/APlayer.min.css'
// import APlayer from 'APlayer'
// import wxConfig from "./utils/wxConfig";

export default {
  computed: {
    ...mapState({
      isLoading: state => state.isLoading
    })
  },
  name: 'App',
  data () {
    return {
      suofang: true,
      transitionName: 'slide-left',
      alive: false
    }
  },
  methods: {
    bofang () {

    }
  },
  //  cssFullscreen: true,
  mounted () {
  },
  watch: {
    $route (to, form) {
      this.$nextTick(() => {
        if (to.path === '/home') {
          this.alive = true
        }
        if (!document.querySelector('.logo')) {
          this.$store.dispatch('cleartime')
        } else {
          if (this.$store.state.audio.audioplayer) {
            if (this.$store.state.audio.audioplayer.paused === false) {
              zhuan()
            }
            // if (this.$store.state.audio.audioplayer.paused === false) {
            // } else {
            //   this.$store.dispatch('cleartime')
            // }
          }
        }
      })
      if (to.query.itemTitle) {
        document.title = to.query.itemTitle
      } else {
        if (to.meta.title === undefined) {
          document.title = '知运-知识改变命运'
        } else {
          document.title = to.meta.title
        }
      }
    }
  },
  created () {
  // const url = window.location.href.split("#")[0];
  // const HREF =
  //   url.indexOf("?") > -1 ? url.substring(0, url.indexOf("?")) : url;
  // if (url.indexOf("?") > -1 && url.indexOf("?code") == -1) {
  //   window.location.replace(HREF + "#" + this.$router.fullPath);
  // }
  // wxConfig();
  }
}
</script>

<style scoped>
.myvideos {
  width: 100%;
}
.loading {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ffffff;
  z-index: 100000000000;
  display: flex;
  align-items: center;
  justify-content: center;
}
#aplayer {
  opacity: 0;
  z-index: -100;
  top: 0;
  left: 0;
  position: fixed;
}
</style>
